import { createRouter, createWebHashHistory } from 'vue-router';
import Home from '@/views/Home.vue';
import Market from '@/views/Market.vue';
import Product from '@/views/product/Product.vue';
import Menber from '@/views/Menber.vue';
import Setting from '@/views/Setting.vue';
import Config from '@/views/Config.vue';
import ProductIndex from '@/views/product/index.vue';


const router = createRouter({
    history:createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'home',
            component:Home,
            meta:{
                requiresAuth:true,
                key:'概览'
            }
        },
        {
            path: '/market',
            name: 'market',
            component: Market,
            meta:{
                requiresAuth:true,
                key:"销售"
            }
        },
        {
            path: '/product',
            name: 'product',
            component: Product,
            meta:{
                requiresAuth:true,
                key:'商品'
            },
            children: [
                {
                    path: '/product/center',
                    name: 'productCenter',
                    component: ProductIndex,
                    meta:{
                        requiresAuth:true,
                        key:"商品中心"
                    }
                },
                {
                    path: '/product/info',
                    name: 'productInfo',
                    component: ()=> import("@/views/product/info.vue"),
                    meta:{
                        requiresAuth:true,
                        key:"商品资料"
                    }
                },
                {
                    path: '/product/type',
                    name: 'productType',
                    component: ()=> import("@/views/product/type.vue"),
                    meta:{
                        requiresAuth:true,
                        key:"商品分类"
                    }
                },
                {
                    path: '/product/setting',
                    name: 'productSetting',
                    component: ()=> import("@/views/product/setting.vue"),
                    meta:{
                        requiresAuth:true,
                        key:"商品设置"
                    }
                },
                {
                    path: '/product/sorting',
                    name: 'productSorting',
                    component: ()=> import("@/views/product/sorting.vue"),
                    meta:{
                        requiresAuth:true,
                        key:"商品排序"
                    }
                },

            ]
        },
        {
            path: '/menber',
            name: 'menber',
            component: Menber,
            meta:{
                requiresAuth:true,
                key:"会员"
            }
        },
        {
            path: '/menber',
            name: 'menber',
            component: Menber,
            meta:{
                requiresAuth:true,
                key:"会员"
            }
        },
        {
            path: '/setting',
            name: 'setting',
            component: Setting,
            meta:{
                requiresAuth:true,
                key:"设置"
            }
        },
        {
            path: '/config',
            name: 'config',
            component: Config,
            meta:{
                requiresAuth:true,
                key:"配置"
            }
        },
       
    ]
})

export default router;